package cj.hrm.dao;


import cj.hrm.dao.provider.JobDynaSqlProvider;
import cj.hrm.entity.Job;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

import java.util.List;
import java.util.Map;

import static cj.hrm.util.common.HrmConstants.JOBTABLE;


public interface JobDao {
    //查询
    @Select("select * from " + JOBTABLE + " ")
    List<Job> selectAllJob();
    @Select("select * from " + JOBTABLE + "  where name like CONCAT('%',#{content},'%')"
            + "or remark like CONCAT('%',#{content},'%')")
    List<Job> get_LikeList(String content);

	//动态插入职位
    @SelectProvider(type = JobDynaSqlProvider.class, method = "insertJob")
    void insert_Job(Job job);
	//动态修改部门
    @SelectProvider(type = JobDynaSqlProvider.class, method = "updateJob")
    void update_Job(Job job);
	// 动态查询
	@SelectProvider(type=JobDynaSqlProvider.class,method="selectWhitParam")
	List<Job> selectByPage(Map<String, Object> params);
    // 根据id删除职位
    @Delete(" delete from " + JOBTABLE + " where id = #{id} ")
    void deleteJobById(Integer id);
    //根据name查询职位
    @Select("select * from " + JOBTABLE + " where name = #{name}")
    Job selectJobByName(String name);
	//根据id查询职位
    @Select("select * from " + JOBTABLE + " where id = #{id}")
    Job selectById(Integer id);
    @SelectProvider(type=JobDynaSqlProvider.class,method="count")
    Integer count(Map<String, Object> params);

}
